<?php

/**
 * Description of Configuration
 *
 * @author FFOZEU
 */
namespace Library;

class Config extends ApplicationComponent{
    
    protected $vars = array();
    
    public function __construct(Application $app){
        parent::__construct($app);
    }
    public function get($var){
        if (!$this->vars){
            $xml = new \DOMDocument;
            $xml->load(dirname(__FILE__).'/../Applications/'.$this->app->name().'/Config/app.xml');
            $elements = $xml->getElementsByTagName('define');
            foreach ($elements as $element){
                $this->vars[$element->getAttribute('var')] = $element->getAttribute('value');
            }
        }
        if (isset($this->vars[$var])){
            return $this->vars[$var];
        }
        return null;
    }
}

?>
